package demo

import org.junit.Test
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.data.redis.core.RedisOperations
import org.springframework.data.redis.core.RedisTemplate
import org.springframework.data.redis.core.ValueOperations
import org.springframework.test.context.junit4.SpringRunner

import javax.xml.crypto.Data
import java.util.concurrent.TimeUnit

@RunWith(SpringRunner)
@SpringBootTest
class MyTest {

    @Autowired
    RedisTemplate redisTemplate

    @Test
    void t() {

        RedisOperations

        ValueOperations<String,String> ope=redisTemplate.opsForValue()

        ope.set('key','value',60, TimeUnit.SECONDS)

        redisTemplate.expireAt('key',new Date(System.currentTimeMillis()))

        println(redisTemplate.getExpire('key'))

    }

}
